home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1998 / MacHack 1998.toast / The Hacks! / WackyWindows / Patches / Patch.h < prev    next >
Encoding:
Text File  |  1998-06-16  |  4.2 KB  |  119 lines  |  [TEXT/CWIE]

  1. // ******************************************************************
  2. //    program written by 
  3. //                         Paul Baxter
  4. //                         MacHack'98
  5. //
  6. // ******************************************************************
  7. #define kStartSpeed                40        // pixels per MoveWindow
  8. #define kMinSpeed                20
  9. #define kMinBounces                3        // number of bounces
  10. #define kMaxBounces                8
  11. #define kMinSpeedMultiPlier        1        // speed increase for each bounce
  12. #define kMaxSpeedMultiplier        2
  13. #define kDirectionChangeLow        0        // initial direction
  14. #define kDirectionChangeHi        1000
  15. #define kDirectionThreshHold    500        // chance for negative direction
  16. #define kStepsBack                3        // Frames to return to orignal position
  17.  
  18. #define kPatchType68K            'PT68'
  19. #define kPatchTypePPC            'PTPP'
  20. #define kPatchSigniture            '_-_-'    // not too many people use this as a window refcon
  21.  
  22.  
  23. // Here are the very ugly RoutineDescriptors
  24. #ifdef powerc
  25.     // SoundPlayer
  26.     enum {
  27.         PlaySoundUPPProcInfo = kPascalStackBased
  28.              | RESULT_SIZE(SIZE_CODE(kNoByteCode))
  29.     };
  30.     typedef UniversalProcPtr PlaySoundUPP;
  31.  
  32.     #define NEW_PLAYSOUNDPROC(proc) (PlaySoundUPP) \
  33.             NewRoutineDescriptor((ProcPtr)(proc), PlaySoundUPPProcInfo, GetCurrentArchitecture())
  34.  
  35.     #define NEW_68KPLAYSOUNDPROC(proc) (PlaySoundUPP) \
  36.             NewRoutineDescriptor((ProcPtr)(proc), PlaySoundUPPProcInfo, kM68kISA)
  37.  
  38.     #define CALL_SOUNDPROC(proc) (PlaySoundUPP) \
  39.             CallUniversalProc((UniversalProcPtr) (proc), PlaySoundUPPProcInfo)
  40.  
  41.     // Patch Installer
  42.     enum {
  43.         PatchInstallerUPPProcInfo = kPascalStackBased
  44.              | RESULT_SIZE(SIZE_CODE(sizeof(ProcPtr)))
  45.              | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(PlaySoundUPP)))
  46.              | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(PlaySoundUPP)))
  47.              | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(short)))
  48.              | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(short)))
  49.     };
  50.     typedef UniversalProcPtr PatchInstallerUPP;
  51.  
  52.     #define NEW_PATCH_INSTALLER_PROC(proc) (PatchInstallerUPP) \
  53.             NewRoutineDescriptor((ProcPtr)(proc), PatchInstallerUPPProcInfo, GetCurrentArchitecture())
  54.  
  55.     #define NEW_68K_PATCH_INSTALLER_PROC(proc) (PatchInstallerUPP) \
  56.             NewRoutineDescriptor((ProcPtr)(proc), PatchInstallerUPPProcInfo, kM68kISA)
  57.  
  58.     #define CALL_PATCH_INSTALLER_PROC(proc, p1, p2, p3, p4) \
  59.             CallUniversalProc((UniversalProcPtr) (proc) , PatchInstallerUPPProcInfo, p1, p2, p3, p4)
  60.  
  61.     // Sound Installer
  62.     enum {
  63.         SoundInstallerUPPProcInfo = kPascalStackBased
  64.              | RESULT_SIZE(SIZE_CODE(sizeof(PlaySoundUPP)))
  65.              | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
  66.              | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short*)))
  67.              | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(SndListHandle*)))
  68.     };
  69.     typedef UniversalProcPtr SoundInstallerUPP;
  70.  
  71.     #define NEW_SOUND_INSTALLER_PROC(proc) (SoundInstallerUPP) \
  72.             NewRoutineDescriptor((ProcPtr)(proc), SoundInstallerUPPProcInfo, GetCurrentArchitecture())
  73.  
  74.     #define NEW_68K_SOUND_INSTALLER_PROC(proc) (SoundInstallerUPP) \
  75.             NewRoutineDescriptor((ProcPtr)(proc), SoundInstallerUPPProcInfo, kM68kISA)
  76.  
  77.     #define CALLSOUND_INSTALLER_PROC(proc, p1, p2, p3) \
  78.             CallUniversalProc((UniversalProcPtr) (proc) , SoundInstallerUPPProcInfo, p1, p2, p3)
  79.  
  80.  
  81. #else
  82.  
  83.     // SoundPlayer
  84.     enum {
  85.         PlaySoundUPPProcInfo = 0
  86.     };
  87.     typedef pascal void (*PlaySoundPtr)(void);
  88.     typedef PlaySoundPtr PlaySoundUPP;
  89.  
  90.     #define NEW_PLAYSOUNDPROC(proc)     (PlaySoundUPP)(proc)
  91.     #define NEW_68KPLAYSOUNDPROC(proc)     (PlaySoundUPP)(proc)
  92.  
  93.     #define CALL_SOUNDPROC(proc) (* (PlaySoundPtr) (proc))()
  94.  
  95.     // Patch Installer
  96.     enum {
  97.         PatchInstallerUPPProcInfo = 0
  98.     };
  99.     typedef pascal ProcPtr (*PatchInstallerPtr)(PlaySoundUPP, PlaySoundUPP, short, short);
  100.     typedef PatchInstallerPtr PatchInstallerUPP;
  101.     #define NEW_PATCH_INSTALLER_PROC(proc) (PatchInstallerUPP)(proc)
  102.     #define NEW_68K_PATCH_INSTALLER_PROC(proc) (PatchInstallerUPP)(proc)
  103.     #define CALL_PATCH_INSTALLER_PROC(proc, p1, p2, p3, p4)  (*(PatchInstallerPtr)(proc))(p1, p2, p3, p4)
  104.  
  105.     // Sound Installer
  106.     enum {
  107.         SoundInstallerUPPProcInfo = 0
  108.     };
  109.     typedef pascal PlaySoundUPP (*SoundInstallerPtr)(short, short*, SndListHandle*);
  110.     typedef SoundInstallerPtr SoundInstallerUPP;
  111.  
  112.     #define NEW_SOUND_INSTALLER_PROC(proc) (SoundInstallerUPP)(proc)
  113.     #define NEW_68K_SOUND_INSTALLER_PROC(proc) (SoundInstallerUPP)(proc)
  114.     #define CALL_SOUND_INSTALLER_PROC(proc, p1, p2, p3)  (*(SoundInstallerPtr)(proc))(p1, p2, p3)
  115.  
  116. #endif
  117.  
  118. extern PlaySoundUPP gSoundPlayer;
  119.